package network;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerApp {

	public static void main(String[] args) throws Exception {
		ServerSocket ss = new ServerSocket(8000);
		
		Socket con = null;
		con = ss.accept();
		
		InputStream in = con.getInputStream();
		OutputStream out = con.getOutputStream();
		
		out.write("hello".getBytes());
		out.flush();
		System.out.println("服务器发送：hello");
		byte[] buf = new byte[1024];
		
		int l = in.read(buf);
		String c2s = new String(buf,0,l);
		System.out.println(c2s);
		System.out.println("服务器发送："+c2s);
	}

}
